// Implicit group for all logged-in accounts
$wgGroupPermissions['user' ]['move'] = true;
$wgGroupPermissions['user' ]['move-subpages'] = true;
+$wgGroupPermissions['user' ]['move-rootuserpages'] = true; // can move root userpages
$wgGroupPermissions['user' ]['read'] = true;
$wgGroupPermissions['user' ]['edit'] = true;
$wgGroupPermissions['user' ]['createpage'] = true;
$wgGroupPermissions['sysop']['importupload'] = true;
$wgGroupPermissions['sysop']['move'] = true;
$wgGroupPermissions['sysop']['move-subpages'] = true;
+$wgGroupPermissions['sysop']['move-rootuserpages'] = true;
$wgGroupPermissions['sysop']['patrol'] = true;
$wgGroupPermissions['sysop']['autopatrol'] = true;
$wgGroupPermissions['sysop']['protect'] = true;
( !$this->isTalkPage() && !$user->isAllowed( 'createpage' ) ) ) {
$errors[] = $user->isAnon() ? array ('nocreatetext') : array ('nocreate-loggedin');
}
- } elseif( $action == 'move' && !( $this->isMovable() && $user->isAllowed( 'move' ) ) ) {
- $errors[] = $user->isAnon() ? array ( 'movenologintext' ) : array ('movenotallowed');
+
+ } elseif ( $action == 'move' ) {
+ if ( !$user->isAllowed( 'move' ) ) {
+ // User can't move anything
+ $errors[] = $user->isAnon() ? array ( 'movenologintext' ) : array ('movenotallowed');
+ } elseif ( !$user->isAllowed( 'move-rootuserpages' )
+ && $this->getNamespace() == NS_USER && !$this->isSubpage() )
+ {
+ // Show user page-specific message only if the user can move other pages
+ $errors[] = array( 'cant-move-user-page' );
+ }
+
+ // Check for immobile pages
+ if ( !MWNamespace::isMovable( $this->getNamespace() ) ) {
+ // Specific message for this case
+ $errors[] = array( 'immobile-source-namespace', $this->getNsText() );
+ } elseif ( !$this->isMovable() ) {
+ // Less specific message for rarer cases
+ $errors[] = array( 'immobile-page' );
+ }
+
+ } elseif ( $action == 'move-target' ) {
+ if ( !$user->isAllowed( 'move' ) ) {
+ // User can't move anything
+ $errors[] = $user->isAnon() ? array ( 'movenologintext' ) : array ('movenotallowed');
+ } elseif ( !$user->isAllowed( 'move-rootuserpages' )
+ && $this->getNamespace() == NS_USER && !$this->isSubpage() )
+ {
+ // Show user page-specific message only if the user can move other pages
+ $errors[] = array( 'cant-move-to-user-page' );
+ }
+ if ( !MWNamespace::isMovable( $this->getNamespace() ) ) {
+ $errors[] = array( 'immobile-target-namespace', $this->getNsText() );
+ } elseif ( !$this->isMovable() ) {
+ $errors[] = array( 'immobile-target-page' );
+ }
+
} elseif ( !$user->isAllowed( $action ) ) {
$return = null;
$groups = array_map( array( 'User', 'makeGroupLinkWiki' ),
* @return \type{\mixed} True on success, getUserPermissionsErrors()-like array on failure
*/
public function isValidMoveOperation( &$nt, $auth = true, $reason = '' ) {
+ global $wgUser;
+
$errors = array();
if( !$nt ) {
// Normally we'd add this to $errors, but we'll get
if( $this->equals( $nt ) ) {
$errors[] = array('selfmove');
}
- if( !$this->isMovable() || !$nt->isMovable() ) {
- $errors[] = array('immobile_namespace');
+ if( !$this->isMovable() ) {
+ $errors[] = array( 'immobile-source-namespace', $this->getNsText() );
+ }
+ if ( !$nt->isMovable() ) {
+ $errors[] = array('immobile-target-namespace', $nt->getNsText() );
}
$oldid = $this->getArticleID();
}
if ( $auth ) {
- global $wgUser;
$errors = wfArrayMerge($errors,
$this->getUserPermissionsErrors('move', $wgUser),
$this->getUserPermissionsErrors('edit', $wgUser),
- $nt->getUserPermissionsErrors('move', $wgUser),
+ $nt->getUserPermissionsErrors('move-target', $wgUser),
$nt->getUserPermissionsErrors('edit', $wgUser));
}
$errors[] = array('spamprotectiontext');
}
- global $wgUser;
$err = null;
if( !wfRunHooks( 'AbortMove', array( $this, $nt, $wgUser, &$err, $reason ) ) ) {
$errors[] = array('hookaborted', $err);
In those cases, you will have to move or merge the page manually if desired.",
'movearticle' => 'Move page:',
+'movenologin' => 'Not logged in',
+'movenologintext' => 'You must be a registered user and [[Special:Userlogin|logged in]] to move a page.',
'movenotallowed' => 'You do not have permission to move pages.',
+'cant-move-user-page' => 'You do not have permission to move user pages (apart from subpages).',
+'cant-move-to-user-page' => 'You do not have permission to move a page to a user page (except to a user subpage).',
'newtitle' => 'To new title:',
'move-watch' => 'Watch this page',
'movepagebtn' => 'Move page',
'delete_and_move_reason' => 'Deleted to make way for move',
'selfmove' => 'Source and destination titles are the same;
cannot move a page over itself.',
-'immobile_namespace' => 'Source or destination title is of a special type;
-cannot move pages from and into that namespace.',
+'immobile-source-namespace' => 'Cannot move pages in namespace "$1"',
+'immobile-target-namespace' => 'Cannot move pages into namespace "$1"',
+'immobile-source-page' => 'This page is not movable.',
+'immobile-target-page' => 'Cannot move to that destination title.',
'imagenocrossnamespace' => 'Cannot move file to non-file namespace',
'imagetypemismatch' => 'The new file extension does not match its type',
'imageinvalidfilename' => 'The target file name is invalid',